<?php
	@$cmd = $_GET['cmd'];
	$INCLUDE_PATH = '';
	$TITLE = '';
	$NAVIGATIVE = '';
	$index_active = '';
	$intro_active = '';
	$prod_active = '';
	$proj_active = '';
	$cont_active = '';
	$search_val = 'Tìm kiếm sản phẩm...';
	
	include_once('libs/htdu_core.php');
	$exec_mysql = new execute_mysql_query();
	
	switch($cmd)
	{
		case 'index':
			$TITLE = 'Trang chủ';
			$NAVIGATIVE = 'Trang chủ';
			$INCLUDE_PATH = 'subs/index.php';
			$index_active = 'class = "active"';
			break;
		case 'intro':
			$TITLE = 'Giới thiệu';
			$NAVIGATIVE = 'Giới thiệu';
			$INCLUDE_PATH = 'subs/intro.php';
			$intro_active = 'class = "active"';
			break;
		case 'product':
			$TITLE = 'Sản phẩm';
			$NAVIGATIVE = 'Sản phẩm';
			@$cat = $_GET['cat'];
			if($cat != '')
			{
				$cat = str_replace('-','',$cat);
				$cat_name = $exec_mysql->execute("select name from category where id = $cat", 1);
				$NAVIGATIVE = 'Sản phẩm » '.$cat_name;
			}
			
			$INCLUDE_PATH = 'subs/product.php';
			$prod_active = 'class = "active"';
			break;
		case 'project':
			$TITLE = 'Dự án';
			$NAVIGATIVE = 'Dự án';
			$INCLUDE_PATH = 'subs/project.php';
			$proj_active = 'class = "active"';
			break;
		case 'contact':
			$TITLE = 'Liên hệ';
			$NAVIGATIVE = 'Liên lệ';
			$INCLUDE_PATH = 'subs/contact.php';
			$cont_active = 'class = "active"';
			break;
		case 'search':
			$TITLE = 'Tìm kiếm';
			$NAVIGATIVE = 'Tìm kiếm';
			$INCLUDE_PATH = 'subs/search.php';
			$search_val = $_GET['q'];
			break;
		default:
			$TITLE = 'Trang chủ';
			$NAVIGATIVE = 'Trang chủ';
			$INCLUDE_PATH = 'subs/index.php';
			$index_active = 'class = "active"';
			break;
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" href="css/layout.css" type="text/css" />
        <link rel="stylesheet" href="css/control.css" type="text/css" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
        <script type="text/javascript" src="http://cdn.dev.skype.com/uri/skype-uri.js"></script>
        <script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js"></script>
        <script type="text/javascript" src="js/master_script.js"></script>
        <title><?php print $TITLE; ?> - Partition WC</title>
    </head>
    
    <body>
        <div class="top">
        	<span class="span-support-online">Hỗ trợ trực tuyến:</span>
            <!--Yahoo-->
            <div class="yahoo">
            	<?php
                	$yahoo = $exec_mysql->execute("select val from extra where ref = 'yahoo'", 1);
					$skype = $exec_mysql->execute("select val from extra where ref = 'skype'", 1);
					$hot_line = $exec_mysql->execute("select val from extra where ref = 'hot_line'", 1);
					$hot_email = $exec_mysql->execute("select val from extra where ref = 'email'", 1);
					print('<a href="ymsgr:sendIM?'.$yahoo.'"><img src="http://opi.yahoo.com/online?u='.$yahoo.'&m=g&t=1"/></a>')
				?>
            </div>
            
            <!--Skype-->
            <div id="SkypeButton_Chat" class="skype">
				<script type="text/javascript">
                	Skype.ui({
                    	"name": "chat",
                    	"element": "SkypeButton_Chat",
                    	"participants": ["<?php print $skype; ?>"]
                	});
                </script>
            </div>
            <div class="divider-top">|</div>
            <!--Hot-line-->
            <div class="hot-line">
            	Hot-line: <?php print $hot_line; ?>
            </div>
             <div class="divider-top">|</div>
            <!--Email-->
            <div class="hot-email">
            	Email: <?php print $hot_email; ?>
            </div>
            <!--Search box-->
            <div class="search-box">
            	<input name="q" class="textbox-search" value="<?php print htmlspecialchars($search_val); ?>" id="txt-keyword" />
            </div>
        </div>
        <div class="logo-menu">
        	<div class="logo-menu-containt">
            	<div class="logo"><a href="."><img src="img/vach-chi-logo.png" title="Partition WC" /></a></div>
                <ul class="ul-menu">
                	<li><a href="lien-he.html" <?php print $cont_active; ?>>Liên hệ</a></li>
                	<li><a href="du-an.html" <?php print $proj_active; ?>>Dự án</a></li>
                    <li><a href="san-pham.html" <?php print $prod_active; ?>>Sản phẩm</a></li>
                    <li><a href="gioi-thieu.html" <?php print $intro_active; ?>>Giới thiệu</a></li>
                    <li><a href="trang-chu.html" <?php print $index_active; ?>>Trang chủ</a></li>
                </ul>
            </div>
        </div>
        <div class="slideshow" id="slideshow">
        	<?php
            	foreach (glob("pics/*.jpg") as $filename)
				{
   					print('<img src="'.$filename.'" />');
				}
			?>
        </div>
        <div class="body-site">
        	<div class="body-site-top"></div>
            <div class="body-site-middle">
            	<!-- Navigative -->
                <div class="navigative">
                	<span class="span-nav"><?php print $NAVIGATIVE; ?></span>
                </div>
                <!-- Body containt -->
                <div class="body-containt">
                	<?php include_once($INCLUDE_PATH); ?>
                </div>
            </div>
            <div class="body-site-bottom"></div>
            <?php
            	$footer = $exec_mysql->execute("select val from extra where ref = 'footer'", 1);
				print $footer;
			?>
        </div>
    </body>
</html>